\section{ MPLS restoration using CSPF}
\label{sec:CSPF}

In the next two scenarios, called CSPF and CSPF1, we realized dynamic LSP protection using the \textit{Constrained Shortest Path First} algorithm. 
CSPF is an extension of the normal shortest path first algorithm that allows to impose a set of constraint on the path to be found. 
When the egress router of an LSP detects a node or a link failure, it will make use of CSPF to compute a new route. 
The implementation of CSPF uses of the \textit{opaque link state advertisement} to eliminate those links that violate a given set of constraints. 
At this point, the new path is found using the Dijkstra's algorithm and then is reserved using RSVP.
MPLS has been configured to wait 40 seconds before try to send the traffic on the LSP (Primary LSP$\rightarrow$Recovery Parameters$\rightarrow$Retry Timer).
This is the default value found in OPNET.

\subsection{scenario 1}

\graphicspath{{./figures/CSPF2/}}

\begin{figure}[!htbp]
\centering
\includegraphics[width=\textwidth]{CSPF2lsp_before_fail.pdf} 
\caption{ LSP path before the link failure.}
\label{fig:CSPF2_before_fail}
\end{figure}

In this scenario we have established an LSP that goes from \textit{node\_0} to \textit{node\_3}. 
As one can expect, the path choosen for our LSP goes through \textit{node\_0} \textit{node\_1} \textit{node\_2} \textit{node\_3} as it is shown in Figure \ref{fig:CSPF2_before_fail}.

\begin{figure}[!htbp]
\centering
\includegraphics[width=\textwidth]{CSPF2lsp_after_fail.pdf} 
\caption{LSP path after the link failure.}
\label{fig:CSPF2_after_fail}
\end{figure}


When the fail in the link \textit{node\_1 to node\_2} occurs, a new path is computed using  CSPF as we can see from Figure \ref{fig:CSPF2_after_fail}. 
The setup time for the LSP is 140 microseconds while the reroute time is 23 microseconds.
Anyway the retry timer parameter dominates since it is set to 40 seconds.  
In this period of time, we expected to see some traffic loss in the receiver. 
We know that during the lsp down period the traffic is routed by using normal IP routing but we expected that also
OSPF need to compute new paths. 
In figure \ref{fig:CSPF2 } we can see that the receiver have not suffered of any traffic loss.

\begin{figure}[!htbp]
\centering
\includegraphics[width=\textwidth]{CSPF2stat.pdf} 
\caption{Traffic received from the destination (Graph 1) and traffic passing through the LSP (Graph 2). }
\label{fig:CSPF2 }
\end{figure}

\FloatBarrier
\subsection{Scenario 2}
\graphicspath{{./figures/CSPF1/}}

\begin{figure}[!htbp]
\centering
\includegraphics[width=\textwidth]{CSPF_scenario.pdf} 
\caption{ Setup of the second CSPF scenario.}
\label{fig:CSPF2_setup}
\end{figure}

In this scenario ( \ref{fig:CSPF2_setup} ), we have the primary LSP between \textit{node\_0}  and \textit{node\_3}  (blue LSP) as in the prevoius scenario.
We added a backup LSP (the red one) between the same two nodes but forced to pass in \textit{node\_6}.
In this case, after the fail, the traffic is switched to the backup LSP, that does not pass through the damaged link, and then back to the primary after it is restored.

\begin{figure}[!htbp]
\centering
\includegraphics[width=\textwidth]{CSPF1lsps.pdf} 
\caption{ Traffic in the primary and backup LSP.}
\label{fig:CSPF1_traffic}
\end{figure}

\begin{figure}[!htbp]
\centering
\includegraphics[width=\textwidth]{CSPF1paths.pdf} 
\caption{ LSP paths during the simulation.}
\label{fig:CSPF2_paths}
\end{figure}

In this case, the results were exactly as expected. 
As we can see in Figure \ref{fig:CSPF1_traffic}, the traffic is switched to the backup lsp just after the failure.
The convergence time of CSPF, to find the new path for the primary LSP, is 5 seconds (Figure \ref{fig:CSPF2_convergence}), but because of the retry timer of MPLS is set to 40 seconds so the traffic return to the primary LSP only after 40 seconds.
The setup time for the lsp after the fail has been of 140 microseconds while the reroute time has been 21 microseconds.

\begin{figure}[!htbp]
\centering
\includegraphics[width=\textwidth]{CSPF1convergence.pdf} 
\caption{ in red the convergence time of OSPF, in blue OSPF convergence activity.}
\label{fig:CSPF2_convergence}
\end{figure}